package com.yekaile.carsystem.service;

import com.yekaile.carsystem.entity.SystemLog;
import com.yekaile.carsystem.entity.SystemLogExample;
import com.yekaile.carsystem.mapper.SystemLogMapper;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author yekaile
 */
@Service
@AllArgsConstructor(onConstructor_=@Autowired)
public class SystemLogServiceImpl implements SystemLogService {

    SystemLogMapper systemLogMapper;


    @Override
    public List<SystemLog> listAllSystemLog() {
        SystemLogExample example=new SystemLogExample();
        SystemLogExample.Criteria criteria=example.createCriteria();
        criteria.andIsDeletedEqualTo(0);
        return systemLogMapper.selectByExample(example);
    }

    @Override
    public Integer deleteSystemLog(Integer logId) {
        SystemLog log=systemLogMapper.selectByPrimaryKey(logId);
        log.setIsDeleted(1);
        return systemLogMapper.updateByPrimaryKeySelective(log);
    }
}
